<?php

namespace app\shop\validate;

class LoginValidate extends BaseValidate
{
    protected $rule = [
        'code'             => 'require',
        'login_code'       => 'require',
        'captcha_code'     => 'require',
        'phone'            => 'require',
        'username'         => 'require',
        'password'         => 'require',
        'sms_captcha_code' => 'require',
    ];

    protected $message = [
        'code.require'             => 'code不能为空',
        'login_code.require'       => '登录code不能为空',
        'captcha_code.require'     => '验证码错误',
        'phone.require'            => '手机号不能为空',
        'username.require'         => '用户名不能为空',
        'password.require'         => '密码不能为空',
        'sms_captcha_code.require' => '短信验证码错误'
    ];

    protected $scene = [
        'mini_app_login' => ['login_code', 'code'],
        'login_legality' => ['login_code'],
        'login_config'   => ['login_code'],
        'quick_login'    => ['login_code'],
        'password_login' => ['username', 'password'],
        'phone_login'    => ['phone', 'sms_captcha_code'],
        'register'       => ['username', 'password', 'phone', 'sms_captcha_code']
    ];
}
